89e133d70716b2c536d1de3eb11f5eddf45eba68,src/client/java/mousio/client/retry/RetryPolicy.java,RetryPolicy,retry,#ConnectionState#RetryHandler#ConnectionFailHandler#,36
Before Change
* @param failHandler handles the fail
*/
public void retry(final ConnectionState state, final RetryHandler retryHandler, final ConnectionFailHandler failHandler) {
timer.newTimeout(new TimerTask() {
@Override public void run(Timeout timeout) throws Exception {
retryAllUris(state, retryHandler, failHandler);
}
}, this.getRetryTimeInMs(), TimeUnit.MILLISECONDS);
}
/**
After Change
}
state.uriIndex++;
if (state.uriIndex >= state.uris.length) {
if (this.shouldRetry(state)) {
logger.debug(String.format("Retry %s to send command", state.retryCount));
state.retryCount += 1;
state.uriIndex = 0;
timer.newTimeout(new TimerTask() {
@Override public void run(Timeout timeout) throws Exception {
try {
retryHandler.doRetry();
} catch (IOException e) {
failHandler.catchException(e);
}
}
}, state.msBeforeRetry, TimeUnit.MILLISECONDS);
} else {
throw new RetryCancelled();
}